/**   
 * @Title: ClassicUserServiceImpl.java   
 * @Package edu.adweb.ssh.service   
 * @Description: TODO(用一句话描述该文件做什么)
 * Copyright: Copyright (c)  2011  
 * Company: Fudan   
 * @author FangYong   
 * @date 2011 2011-3-31 上午09:21:42   
 *@version 1.0   
 */    
package edu.adweb.ssh.service;

import java.util.List;

import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import edu.adweb.ssh.bean.User;
import edu.adweb.ssh.dao.UserDao;

/**
 * @ClassName: ClassicUserServiceImpl   
 * @Description: TODO(这里用一句话描述这个类的作用)   
 * @author FangYong   
 * @date 2011-3-31 上午09:21:42   
 */
public class ClassicUserServiceImpl implements UserService {
	
	private UserDao uDao;
	

	public ClassicUserServiceImpl()
	{
		super();
	}
	/* (none Javadoc)
	 * <p>Title: validate</p>    
	 * <p>Description:  </p>    
	 * @param name
	 * @param password
	 * @return    
	 * @see edu.adweb.ssh.service.UserService#validate(java.lang.String, java.lang.String)    
	 */
	@Override
	@Transactional(isolation = Isolation.READ_COMMITTED)
	public boolean validate(String name, String password) {
		List<User> ret = uDao.find(name);
		for(User u: ret)
		{
			System.out.println(u.getId() + " " + u.getName() + " " + u.getPassword() + " ");
			if(u.getName().equals(name) && u.getPassword().equals(password))
				return true;
		}
		return false;
	}


	/**
	 * @param uDao the uDao to set
	 */
	public void setuDao(UserDao uDao) {
		this.uDao = uDao;
	}


	/**
	 * @return the uDao
	 */
	public UserDao getuDao() {
		return uDao;
	}

}
